package com.ayu.a.practice02;

/**
 * @Author 徐林玉
 * @Description ReverseString
 * @Date 2022/11/14 9:44
 * @Version 1.0
 */
public class ReverseStringPrac {


    public static void main(String[] args) {

        char[] s = new char[]{'h','e','l','l','o','b'};

        reverseString(s);

        for (int i = 0; i < s.length; i++) {

            System.out.print(s[i]+"  ");
        }
    }


    public static void reverseString(char[] s){


        char temp = ' ';

        for (int i = 0; i < s.length/2; i++) {


            temp = s[i];

            s[i] = s[s.length-i-1];

            s[s.length-i-1] = temp;

        }

    }
}
